package com.wufeng.mapper;

import com.wufeng.dto.ArticleUserDto;
import com.wufeng.entity.Article;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author Hxh
 * @description 针对表【article】的数据库操作Mapper
 * @createDate 2023-12-19 21:39:01
 * @Entity com.wufeng.entity.Article
 */
public interface ArticleMapper extends BaseMapper<Article> {


    int addReplycountById(@Param("articleId") int articleId);

    int minusReplycountById(@Param("articleId") int articleId);

    @Update("UPDATE article SET likeCount = likeCount + 1 WHERE articleId = #{articleId}")
    void incrementLikeCount(@Param("articleId") Integer articleid);

    @Update("UPDATE article SET likeCount = likeCount - 1 WHERE articleId = #{articleId}")
    void decrementLikeCount(@Param("articleId") Integer articleid);

    List<ArticleUserDto> getArticleListByCondition(@Param("article") Article article,
                                                   @Param("startIndex") Integer startIndex,
                                                   @Param("pageSize") Integer pageSize);
}




